package com.wei.frame.di.component;

import android.content.Context;

import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;

import javax.inject.Named;

import dagger.Module;
import dagger.Provides;

/**
 * 作者:赵若位
 * 时间:2021/7/1 16:46
 * 功能:RecyclerView布局管理器
 */
@Module
public class RvLayoutManager {

    @Provides
    @Named("Vertical")
    public LinearLayoutManager providerLinearVerticalManager(Context context) {
        return new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false);
    }

    @Provides
    @Named("Horizintal")
    public LinearLayoutManager providerLinearHorizontalManager(Context context) {
        return new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
    }

    @Provides
    public GridLayoutManager providerGridLayoutManager(Context context) {
        return new GridLayoutManager(context, 2);
    }

    @Provides
    public StaggeredGridLayoutManager providerStaggeredGridLayoutManager(Context context) {
        return new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
    }


}
